<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>话题详细</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" th:href="@{/layui/css/layui.css}">

    <link th:href="@{/css/semantic.min.css}" rel="stylesheet">
    <link rel="stylesheet" th:href="@{/css/mian.css}">
    <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
</head>
<body class="lay-blog" >

<!--菜单-->
<ul class="layui-nav layui-bg-blue" lay-filter="">
    <li class="layui-nav-item "><a th:href="@{/community/index}" style="font-size: 20px">首页</a></li>
<!--    <li class="layui-nav-item">-->
<!--        <a href="javascript:;" style="font-size: 20px">习题库</a>-->
<!--        <dl class="layui-nav-child"> &lt;!&ndash; 二级菜单 &ndash;&gt;-->
<!--            <dd>-->
<!--                <a th:href="@{/item/chapter/overview}">分章节练习</a>-->
<!--            </dd>-->
<!--            <dd>-->
<!--                <a th:href="@{/item/overview}">分题型练习</a>-->
<!--            </dd>-->
<!--        </dl>-->
<!--    </li>-->
<!--    <li class="layui-nav-item">-->
<!--        <a href="javascript:;" style="font-size: 20px">课程分类</a>-->
<!--        <dl class="layui-nav-child"> &lt;!&ndash; 二级菜单 &ndash;&gt;-->
<!--            <dd>-->
<!--                <a th:href="@{'/course/type_show/'+${coursetype.getId()}}" th:each="coursetype:${coursetypes}" th:text="${coursetype.getCourse_name()}"></a>-->
<!--            </dd>-->
<!--            <dd>-->
<!--                <a th:href="@{/course/type_show/0}" >全部课程</a>-->
<!--            </dd>-->
<!--        </dl>-->
<!--    </li>-->
<!--    <li class="layui-nav-item layui-this" th:if="${session.loginuser} == null"><a th:href="@{/community/index}" style="font-size: 20px">社区</a></li>-->
<!--    <li class="layui-nav-item layui-this" th:if="${session.loginuser} != null">-->
<!--        <a href="javascript:;" style="font-size: 20px">社区</a>-->
<!--        <dl class="layui-nav-child">-->
<!--            <dd><a th:href="@{/community/index}">社区首页</a></dd>-->
<!--            <dd><a th:href="@{/stu/community/commenting}">发布话题</a></dd>-->
<!--            <dd><a th:href="@{/stu/community/management}">我的话题</a></dd>-->
<!--            <dd><a th:href="@{/stu/chat_all}" target="_blank">头脑风暴</a></dd>-->
<!--        </dl>-->
<!--    </li>-->
<!--    <li class="layui-nav-item"><a th:href="@{/file/list}" style="font-size: 20px">资料干货</a></li>-->

    <!--如果没有登录-->
    <li class="layui-nav-item" th:if="${session.loginuser} == null">
        <a th:href="@{/login}" style="font-size: 20px">登录</a>
    </li>
    <li class="layui-nav-item" th:if="${session.loginuser} == null">
        <a th:href="@{/register}" style="font-size: 20px">注册</a>
    </li>
    <!--如果没有登录-->

    <!--如果登录-->
    <li class="layui-nav-item" th:if="${session.loginuser} != null">
        <a href="javascript:;" style="font-size: 20px">我的班级</a>
        <dl class="layui-nav-child"> <!-- 二级菜单 -->
            <dd>
                <a th:href="@{/stu/map/show}">班级签到</a>
            </dd>
            <dd>
                <a th:href="@{/stu/exam/overview}">班级考试</a>
            </dd>
            <dd>
                <a th:href="@{/stu/exam/mydegree/list}">我的考试成绩</a>
            </dd>
        </dl>
    </li>
    <li class="layui-nav-item" th:if="${session.loginuser} != null">
        <a href="javascript:;" style="font-size: 20px">好友管理</a>
        <dl class="layui-nav-child"> <!-- 二级菜单 -->
            <dd>
                <a th:href="@{/stu/friends/list}">好友列表</a>
            </dd>
            <dd>
                <a th:href="@{/stu/friends/search}">搜索好友</a>
            </dd>
        </dl>
    </li>
    <li class="layui-nav-item" th:if="${session.loginuser} != null">
        <img th:src="@{'/show/'+${session.loginuser.getId()}}" class="layui-nav-img">[[${session.loginuser.username}]]
        <dl class="layui-nav-child">
            <dd><a th:href="@{/stu/center}">个人中心</a></dd>
            <dd><a th:href="@{/stu/logout}">退出</a></dd>
        </dl>
    </li>

    <!--如果登录-->
</ul>
<!--菜单-->


<!--评论信息-->
<div class="container-wrap">
    <div class="container container-message container-details">
        <div class="contar-wrap">

            <!--        课程信息-->
            <div class="item">
                <div class="item-box  layer-photos-demo1 layer-photos-demo">
                    <input type="hidden" id="myid" th:value="${blog.getId()}">
                    <h3><div th:text="${blog.getSubject()}"></div></h3>
                    <h4>发布者：<span th:text="${blog.getUsername()}"></span></h4>
                    <h5>发布于：<span th:text="${#dates.format(blog.getCreatetime(),'yyyy年MM月dd日 HH:mm')}"></span></h5>
                    <div>
                        <!--文章主体内容-->
                        <div id="doc-content" style="width: 80%">
                            <textarea style="display:none;" placeholder="markdown" th:text="${blog.getContent()}"></textarea>
                        </div>
                    </div>
<!--                    <p th:text="${blog.getContent()}"></p>-->
                    <div class="count layui-clear">
<!--                        <span class="pull-left">评论数 <em >12</em></span>-->
                        <span class="pull-right">点赞数 <em th:text="${blog.getPraise()}"></em></span>
<!--                        <span class="pull-right like" id="praisebutton" >-->
<!--                            <input type="hidden" th:value="${blog.getPraise()}" id="praiseinput">-->
<!--                            <i class="layui-icon layui-icon-praise"><em id="praisenumber" th:text="${blog.getPraise()}"></em></i>-->
<!--                        </span>-->
                    </div>
                </div>
            </div>
            <!--            课程信息-->
            <a name="comment"> </a>
            <div class="comt layui-clear">
                <div  class="pull-left">全部评论</div>
            </div>
            <!--评论内容-->
            <div id="LAY-msg-box">
                <div class="info-item" th:each="comment:${comments}">
                    <span><img class="layui-nav-img" th:src="@{'/show/'+${comment.getUser_id()}}" ></span>
                    <span class="name">[[${comment.getUsername()}]]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
                    <span th:text="${#dates.format(comment.getCreatetime(),'yyyy-MM-dd HH:mm')}"></span>
                    <div class="info-text">
                        <p class="info-intr" th:text="${comment.getComment()}"></p>
                    </div>

                    <div class="title count" >
                        <div class="info-img like" th:data="${comment.getId()}">
                            <input type="hidden" th:value="${comment.getPraise()}" class="myinputpraise">
                            <i class="layui-icon layui-icon-praise"></i>
                            <em class="myem" th:text="${comment.getPraise()}"></em>
                        </div>
                        <div th:if="${session.loginuser} != null">
                        <div class="pull-left" th:if="${session.loginuser.getId()==comment.getUser_id()}">
                            <a th:href="@{'/stu/community/blog/comment/delete/'+${comment.getId()}+'/'+${blog.getId()}}"> <i class="layui-icon layui-icon-delete"></i> 删除</a>
                        </div>
                            <div class="pull-left" >
                                <a th:href="@{'/stu/community/blog/comment/reply/'+${comment.getId()}}"> <i class="layui-icon layui-icon-edit"></i> 回复</a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!--评论内容-->

            <!--            写评论-->
            <div class="comt layui-clear">
                <div  class="pull-left">写评论</div>
            </div>
            <form class="layui-form" th:action="@{/stu/community/blog/comment/submit}">
<!--                <input type="hidden" name="user_id" th:value="${topic.getUser_id()}">-->
<!--                <input type="hidden" name="user_name" th:value="${topic.getUsername()}">-->
                <input type="hidden" name="blog_id" th:value="${blog.getId()}">
                <div class="layui-form-item layui-form-text">
                    <textarea  class="layui-textarea" name="comment" style="resize:none" placeholder="写点什么呀"></textarea>
                </div>
                <button class="ui primary button" type="submit">评论</button>
            </form>
            <!--            写评论-->
        </div>
    </div>
</div>
<!--评论信息-->

<!--底部-->
<div class="footer">
    <p>
        <span>&copy; 2020</span>
        <span><a href="http://120.78.82.248:8080" target="_blank">计算机网络课程资源共享网</a></span>
        <span>王侃</span>
    </p>
    <p><span>长风破浪会有时，直挂云帆济沧海</span></p>
</div>
<!--底部-->

<script th:src="@{/layui/layui.js}"></script>
<script th:src="@{/layui/blog.js}">
</script>
<script>
  //    实现点赞功能
  $(document).ready(function () {

      //评论点赞
      $('.info-img.like').click(function () {
          var commentpraise=$(this).attr('data');

          var commentpraisenumber=$(this).children('.myinputpraise').val();
          var praise2=parseInt(commentpraisenumber)+1;
          $(this).children('.myem').text(praise2);
          $.post(
              '/stu/community/blog/comment/praise',
              {'id':commentpraise},
              function (result) {

              }
          )
      });
  })
 //    实现点赞功能
</script>
</body>
<link rel="stylesheet" th:href="@{/editor/css/editormd.preview.css}" />
<script th:src="@{/editor/lib/jquery.min.js}"></script>
<script th:src="@{/editor/lib/marked.min.js}"></script>
<script th:src="@{/editor/lib/prettify.min.js}"></script>
<script th:src="@{/editor/lib/raphael.min.js}"></script>
<script th:src="@{/editor/lib/underscore.min.js}"></script>
<script th:src="@{/editor/lib/sequence-diagram.min.js}"></script>
<script th:src="@{/editor/lib/flowchart.min.js}"></script>
<script th:src="@{/editor/lib/jquery.flowchart.min.js}"></script>
<script th:src="@{/editor/lib/editormd.min.js}"></script>

<script type="text/javascript">
    var testEditor;
    $(function () {
        testEditor = editormd.markdownToHTML("doc-content", {//注意：这里是上面DIV的id
            htmlDecode: "style,script,iframe",
            emoji: true,
            taskList: true,
            tocm: true,
            tex: true, // 默认不解析
            flowChart: true, // 默认不解析
            sequenceDiagram: true, // 默认不解析
            codeFold: true
        });
    });

</script>
</html>